package factory;

import com.lmax.disruptor.dsl.Disruptor;
import config.DisruptorProperties;
import java.util.concurrent.ThreadFactory;

public class EventThreadFactory implements ThreadFactory {

    private int counter = 0;
    private DisruptorProperties disruptorProperties;

    public EventThreadFactory(DisruptorProperties disruptorProperties) {
        this.disruptorProperties = disruptorProperties;
    }

    @Override
    public Thread newThread(Runnable r) {
        Thread t = new Thread(r);
        t.setName(disruptorProperties.getRingThreadName() + " " + counter++);
        t.setDaemon(disruptorProperties.getDaemon());
        return null;
    }
}
